<template>
    <div id="app">
      <el-form ref="add-category" :model="category" label-width="100px">
        <el-form-item label="类别名">
          <el-input v-model="category.categoryName" placeholder="请输入类别名"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="saveCategory()">提交</el-button>
        </el-form-item>
      </el-form>
    </div>
</template>

<script>
    export default {
      data(){
        return {
          category:{}
        }
      },
      methods:{
        saveCategory(){
          //发出ajax请求
          this.axios.post("/category/add",this.category).then((resp)=>{
            this.$router.push("/book/CategoryList");
          })
        }
      }
    }
</script>


<style scoped>

</style>
